#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int prefix_sum(vector<int>&nums,int n) {
	vector<int>dp = nums;
	dp.push_back(nums[0]);
	int max_num = nums[0];
	for (int i = 1; i < n; i++) {
		dp[i] = max(dp[i - 1] + nums[i], nums[i]);
		if (max_num < dp[i])	max_num = dp[i];
	}
	return max_num;
}

int main() {
	int n;	cin >> n;
	int arr[125][125] = { 0 };
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin>>arr[i][j];
		}
	}
	vector<int>sum;
	for (int i = 0; i < n; i++) {
		vector<int>nums;
		for (int k = 0; k < n; k++) {
			nums.push_back(arr[i][k]);
		}
		sum.push_back(prefix_sum(nums,n));
		for (int j = i + 1; j <= n; j++) {
			for (int k=0; k < n; k++) {
				nums[k] += arr[j][k];
			}
			sum.push_back(prefix_sum(nums,n));
		}
	}
	int max = sum[0];
	for (int i = 1; i < sum.size(); i++) {
		if (max < sum[i])	max = sum[i];
	}
	cout << max;
	return 0;
}